package com.div.tools.collection

import android.os.Bundle
import android.os.Handler
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.div.tools.R
import com.div.tools.databinding.CollectionActivityBinding
import kotlinx.android.synthetic.main.activity_collection.*
import java.util.*
import kotlin.collections.ArrayList

class CollectionActivity : AppCompatActivity() {
    private lateinit var binding: CollectionActivityBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this, R.layout.activity_collection)

        var list: List<String> = ArrayList()
        var list1 = arrayListOf<String>("aaaa", "ssss", "ffff")
        binding.test = list1[1]
//        var i = 0
//        while (i < 20) {
//            Thread(object :Runnable{
//                override fun run() {
//                    list1.add(1, "mmmm" + i)
//                }
//
//            }).start()
//            i ++
//        }
//        Log.e("DDW", "start get")
//        for (i in 1..20) {
//            Log.e("DDW", "start get : " + list1.get(2))
//        }
//        Log.e("DDW", "stop get")
//        Log.e("DDW", "start set")
//        for (i in 1..20) {
//            Log.e("DDW", "start set : " + list1.set(2, "pppp"))
//        }
//        Log.e("DDW", "stop set")
//        Log.e("DDW", "start add")
//        for (i in 1..20) {
//            Log.e("DDW", "start add : " + list1.add(2, "oooo"))
//        }
//        Log.e("DDW", "stop add")
//        Handler().post(object :Runnable{
//            override fun run() {
//                Log.e("DDW", "list" + list1.toString())
//            }
//
//        })

    }
}